/* rwrorp.p - ROUTING REPORT                                            */
/* Copyright 1986-2011 QAD Inc., Santa Barbara, CA, USA.                      */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Id:: rwrorp.p 2301 2010-11-08 07:09:06Z jvz                            $: */
/* $Revision: 1.9.1.7 $                                                         */
/*V8:ConvertMode=FullGUIReport                                          */
/* REVISION: 1.0      LAST MODIFIED: 04/30/86   BY: EMB      */
/* REVISION: 1.0      LAST MODIFIED: 08/29/86   BY: EMB *12* *removed 3/30/88**/
/* REVISION: 2.1      LAST MODIFIED: 10/20/87   BY: WUG *A94**/
/* REVISION: 4.0      LAST MODIFIED: 02/17/88   BY: RL  *A171**/
/* REVISION: 4.0      LAST MODIFIED: 02/24/88   BY: WUG *A175**/
/* REVISION: 4.0      LAST MODIFIED: 03/29/88   BY: EMB *A192**/
/* REVISION: 4.0      LAST MODIFIED: 03/18/88   BY: WUG *A194**/
/* REVISION: 6.0      LAST MODIFIED: 03/06/90   BY: emb *D001**/
/* REVISION: 7.3          LAST EDIT: 02/24/93   BY: sas *G740**/
/* REVISION: 7.4      LAST MODIFIED: 01/12/94   BY: qzl *H276*/
/* REVISION: 7.4      LAST MODIFIED: 06/15/94   BY: pxd *FO86*/
/* REVISION: 7.4      LAST MODIFIED: 12/13/94   BY: pxd *FU54*/
/* REVISION: 7.4      LAST MODIFIED: 03/15/96   BY: jym *H0K6*/
/* REVISION: 8.5      LAST MODIFIED: 07/29/96   BY: *J12T* Sue Poland         */
/* REVISION: 8.6      LAST MODIFIED: 10/15/97   BY: bvm *K104**/
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/12/98   BY: *J326* Sandesh Mahagaokar */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.9.1.3     BY: Hualin Zhong   DATE: 05/08/01 ECO: *N0YC*        */
/* Revision: 1.9.1.4  BY: Manjusha Inglay    DATE: 08/28/01 ECO: *P01R* */
/* Revision: 1.9.1.6  BY: Paul Donnelly (SB) DATE: 06/28/03 ECO: *Q00L* */
/* $Revision: 1.9.1.7 $       BY: Reena Ambavi       DATE: 01/21/04 ECO: *P1KD* */
/*-Revision end---------------------------------------------------------------*/

/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* Note: Changes made here may be necessary in fsrorp.p or fsrorpa.p. */

/* DISPLAY TITLE */
{us/mf/mfdtitle.i "1+ "}

define variable part like ro_routing.
define variable part1 like ro_routing.
define variable wkctr like ro_wkctr.
define variable std_op like ro_std_op.
define variable skpge like mfc_logical initial no
   label "Page Break on Routing".
define variable run_rate as decimal
   format "->>,>>>,>>9.99" label "Run Rate".
define variable printcmmt like mfc_logical initial yes
   label "Print Comments".
define variable i as integer.
define variable effdate like ro_start label "Effective".

form
   part           colon 20
   part1          label {us/t0/t001.i} skip (1)
   effdate        colon 27
   wkctr          colon 27
   std_op         colon 27
   skpge          colon 27
   printcmmt      colon 27
with frame a side-labels width 80 attr-space.

/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).
effdate = today.

{us/wb/wbrp01.i}

repeat:

   if part1 = hi_char then part1 = "".

   if c-application-mode <> 'web' then
      update part part1 effdate wkctr std_op skpge printcmmt with frame a.

   {us/wb/wbrp06.i &command = update &fields = "  part part1 effdate wkctr std_op
          skpge printcmmt" &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data')) then do:

      bcdparm = "".
      {us/mf/mfquoter.i part   }
      {us/mf/mfquoter.i part1  }
      {us/mf/mfquoter.i effdate}
      {us/mf/mfquoter.i wkctr  }
      {us/mf/mfquoter.i std_op }
      {us/mf/mfquoter.i skpge  }
      {us/mf/mfquoter.i printcmmt}

      if part1 = "" then part1 = hi_char.

   end.

   /* OUTPUT DESTINATION SELECTION */
   {us/gp/gpselout.i &printType = "printer"
               &printWidth = 132
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "yes"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}
   {us/bbi/mfphead.i}

   for each ro_det  where ro_det.ro_domain = global_domain and (  (ro_routing
   >= part and ro_routing <= part1)
         and (ro_wkctr = wkctr or wkctr = "")
         and (ro_std_op = std_op or std_op = "")
         and ((effdate  = ?) or
             ((effdate  <> ?) and
             (ro_start = ? or ro_start <= effdate) and
             (ro_end   = ? or ro_end >= effdate)))
         ) no-lock break by ro_routing by ro_op
      with frame b width 134 no-attr-space:

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      /* DO NOT INCLUDE SERVICE ROUTINGS ON THIS REPORT */
      if ro_fsm_type <> " " then next.

      if first-of(ro_routing) then do:
         if page-size - line-counter < 6 then page.
         display with frame b.
         find pt_mstr  where pt_mstr.pt_domain = global_domain and  pt_part =
         ro_routing no-lock
            no-wait no-error.

         find bom_mstr  where bom_mstr.bom_domain = global_domain and
         bom_parent = ro_routing no-lock no-error.

         put
            {us/bbi/gplblfmt.i &FUNC=getTermLabel(""ROUTING"",11) &CONCAT="': '"}
            ro_routing.

         if available bom_mstr then do:
            put skip.
            if bom_desc <> "" then put bom_desc.
            put skip.
         end.

         if available pt_mstr then put " " pt_desc1 " " pt_desc2.

      end.     /* if first-of (ro_routing) */

      if page-size - line-counter < 2 then page.

      display
         ro_op
         ro_std_op
         ro_desc format "x(18)"
         ro_wkctr ro_mch
         ro_start ro_end
         ro_queue ro_setup ro_run ro_wait ro_move
         ro_yield_pct
         ro_tool column-label "Tool!Supplier".

      if ro_vend > "" then do:
         down 1.
         display ro_vend @ ro_tool column-label "Tool!Supplier".
      end.

      if printcmmt then do:
         for each cmt_det  where cmt_det.cmt_domain = global_domain and
         cmt_indx = ro_cmtindx no-lock:
            do i = 1 to 15:
               if cmt_cmmt[i] <> "" then do:
                  if page-size - line-counter < 1 then do with frame b:
                     page.
                     display
                        ro_op
                        ro_std_op
                        dynamic-function('getTermLabelFillCentered' in h-label,
                            input "CONTINUE",
                            input 20,
                            input '*') @ ro_desc
                        " " @ ro_wkctr
                        " " @ ro_mch
                        " " @ ro_queue
                        " " @ ro_setup
                        " " @ ro_run
                        " " @ ro_wait
                        " " @ ro_move
                        " " @ ro_yield_pct
                        " " @ ro_tool.
                  end.
                  put cmt_cmmt[i] at 20 skip.
               end.
            end.
            put skip(1).
         end.
      end.     /* if printcmmt */

      if last-of(ro_routing) then do:
         if skpge then page.
      end.

      {us/mf/mfrpchk.i}

   end.    /* for each ro_det */

   /* REPORT TRAILER  */
   {us/mf/mfrtrail.i}

end.   /* mainloop repeat */

{us/wb/wbrp04.i &frame-spec = a}
